package com.example.config;

import com.example.interceptor.TestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * TODO
 *
 * @Author gaokaikai
 * @CreateDate 2023/3/14 16:59
 * @Version 1.0
 */
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Override
    public  void  addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(new TestInterceptor())
                //只拦截这些路径
                .addPathPatterns("/block/test")
                //不拦截这些路径
                .excludePathPatterns("/pass/**");

    }
}
